package graphics.app;

import java.awt.Graphics;
import java.util.Observable;
import java.util.Observer;

import graphics.operations.ProxyOperation;

import javax.swing.JPanel;

public class ApplicationPanel extends JPanel implements Observer{

	public ProxyOperation operation;
	
	public ApplicationPanel(ProxyOperation operation) {
		this.operation=operation;
		operation.getData().addObserver(this);
	}
	
	@Override
	protected void paintComponent(Graphics graphics) {
		super.paintComponent(graphics);

		for (int i = 0; i < operation.getData().getFormeCount(); i++) {
			operation.getData().getForma(i).draw(graphics);
		}
		operation.drawOperationInfo(graphics);
	}
	
	public void update(Observable arg0, Object arg1) {
		repaint();
	}
}
